home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gnu / adainc / a-ststio.ads < prev    next >
Text File  |  1996-01-30  |  4KB  |  118 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT RUNTIME COMPONENTS                          --
  4. --                                                                          --
  5. --                A D A . S T R E A M S . S T R E A M _ I O                 --
  6. --                                                                          --
  7. --                                 S p e c                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.6 $                              --
  10. --                                                                          --
  11. -- This specification is adapted from the Ada Reference Manual for use with --
  12. -- GNAT.  In accordance with the copyright of that document, you can freely --
  13. -- copy and modify this specification,  provided that if you redistribute a --
  14. -- modified version,  any changes that you have made are clearly indicated. --
  15. --                                                                          --
  16. ------------------------------------------------------------------------------
  17.  
  18.  
  19. with Ada.IO_Exceptions;
  20.  
  21. package Ada.Streams.Stream_IO is
  22.  
  23.    type Stream_Access is access Root_Stream_Type'Class;
  24.  
  25.    type File_Type is limited private;
  26.  
  27.    type File_Mode is (In_File, Out_File, Append_File);
  28.  
  29.    type Count is new Stream_Element_Offset;
  30.  
  31.    subtype Positive_Count is Count range 1 .. Count'Last;
  32.    --  Index into file, in stream elements
  33.  
  34.    ---------------------
  35.    -- File Management --
  36.    ---------------------
  37.  
  38.    procedure Create
  39.      (File : in out File_Type;
  40.       Mode : in File_Mode := Out_File;
  41.       Name : in String := "";
  42.       Form : in String := "");
  43.  
  44.    procedure Open
  45.      (File : in out File_Type;
  46.       Mode : in File_Mode;
  47.       Name : in String;
  48.       Form : in String := "");
  49.  
  50.    procedure Close  (File : in out File_Type);
  51.    procedure Delete (File : in out File_Type);
  52.    procedure Reset  (File : in out File_Type; Mode : in File_Mode);
  53.    procedure Reset  (File : in out File_Type);
  54.  
  55.    function Mode (File : in File_Type) return File_Mode;
  56.    function Name (File : in File_Type) return String;
  57.    function Form (File : in File_Type) return String;
  58.  
  59.    function Is_Open     (File : in File_Type) return Boolean;
  60.    function End_Of_File (File : in File_Type) return Boolean;
  61.  
  62.    function Stream  (File : in File_Type) return Stream_Access;
  63.  
  64.    -----------------------------
  65.    -- Input-Output Operations --
  66.    -----------------------------
  67.  
  68.    procedure Read
  69.      (File : in  File_Type;
  70.       Item : out Stream_Element_Array;
  71.       Last : out Stream_Element_Offset;
  72.       From : in  Positive_Count);
  73.  
  74.    procedure Read
  75.      (File : in  File_Type;
  76.       Item : out Stream_Element_Array;
  77.       Last : out Stream_Element_Offset);
  78.  
  79.    procedure Write
  80.      (File : in File_Type;
  81.       Item : in Stream_Element_Array;
  82.       To   : in Positive_Count);
  83.  
  84.    procedure Write
  85.      (File : in File_Type;
  86.       Item : in Stream_Element_Array);
  87.  
  88.    ----------------------------------------
  89.    -- Operations on Position within File --
  90.    ----------------------------------------
  91.  
  92.    procedure Set_Index (File : in File_Type; To : in Positive_Count);
  93.  
  94.    function Index (File : in File_Type) return Positive_Count;
  95.    function Size  (File : in File_Type) return Count;
  96.  
  97.    procedure Set_Mode (File : in out File_Type; Mode : in File_Mode);
  98.  
  99.    procedure Flush (File : in out File_Type);
  100.  
  101.    ----------------
  102.    -- Exceptions --
  103.    ----------------
  104.  
  105.    Status_Error : exception renames IO_Exceptions.Status_Error;
  106.    Mode_Error   : exception renames IO_Exceptions.Mode_Error;
  107.    Name_Error   : exception renames IO_Exceptions.Name_Error;
  108.    Use_Error    : exception renames IO_Exceptions.Use_Error;
  109.    Device_Error : exception renames IO_Exceptions.Device_Error;
  110.    End_Error    : exception renames IO_Exceptions.End_Error;
  111.    Data_Error   : exception renames IO_Exceptions.Data_Error;
  112.  
  113. private
  114.    --  Dummy definition (body not writen yet) ???
  115.  
  116.    type File_Type is new Integer;
  117. end Ada.Streams.Stream_IO;
  118.